import React, { Component } from "react";
import Mrouter from "./router/indexRouter";
import Tabbar from "./commponents/Tabbar";
import "./views/Css/app.css";
import store from "./redux/store";

export default class App extends Component {
  state = {
    isShow: store.getState().TabbarReducer.get("show"),
  };
  //store.subsribe订阅
  componentDidMount() {
    store.subscribe(() => {
      console.log("app中订阅", store.getState());
      this.setState({ isShow: store.getState().TabbarReducer.get("show") });
    });
  }
  constructor(props) {
    super(props);
    this.state = {};
  }

  render() {
    return (
      // Routes只匹配一个 react-router-dom6以上 5以下是switch 同理在 react router v6 中，我们不向 Route 组件传递 children 属性，而是使用 element 属性。例如，<Route path="/about" element={<About />} />。

      // 当使用react router时，请确保将应该为特定路由渲染的组件作为<Component />，而不是Component。
      <div>
        <Mrouter> {this.state.isShow && <Tabbar> </Tabbar>}</Mrouter>
      </div>
    );
  }
}
